package vno.ky.XML
{
	import flash.display.Sprite;
	public class olds extends Sprite
	{
		public function olds()
		{
			var inf:XML=
				<info>
					<map id="6">
						<width>6500</width>
						<height>2800</height>
						<tiles>
							<width>250</width>
							<height>400</height>
							<numX>26</numX>
							<numY>7</numY>
						</tiles>
						<resource>
							<abbreMap>vno/abbreMap.jpg</abbreMap>
							<tiles>vno/MapTiles/0/</tiles>
						</resource>
						<character>
							<npcLayer>
								<npc id="0" x="70" y="400" pic="vno/Characters/Map/9/NPC/0.png"/>
								<npc id="1" x="900" y="100" pic="vno/Characters/Map/9/NPC/1.png"/>
								<npc id="2" x="1250" y="499" pic="vno/Characters/Map/9/NPC/1.png"/>
								<npc id="3" x="470" y="999" pic="vno/Characters/Map/9/NPC/0.png"/>
							</npcLayer>
						</character>
						<moveSpeed>10</moveSpeed>
					</map>
					<map id="7">
						<width>6000</width>
						<height>2800</height>
						<tiles>
							<width>250</width>
							<height>400</height>
							<numX>26</numX>
							<numY>7</numY>
						</tiles>
						<resource>
							<abbreMap>vno/abbreMap.jpg</abbreMap>
							<tiles>vno/MapTiles/0/</tiles>
						</resource>
						<character>
							<npcLayer>
								<npc id="0" x="70" y="400" pic="vno/Characters/Map/9/NPC/0.png"/>
								<npc id="1" x="900" y="100" pic="vno/Characters/Map/9/NPC/1.png"/>
								<npc id="2" x="1250" y="499" pic="vno/Characters/Map/9/NPC/1.png"/>
								<npc id="3" x="470" y="999" pic="vno/Characters/Map/9/NPC/0.png"/>
							</npcLayer>
						</character>
						<moveSpeed>10</moveSpeed>
					</map>
				</info>
//				trace(getXML1(inf));
				var resInfo:XML=
					<res>
						<mapRes>
							<map id="9">
								<thumbmap	id="000000000" url="vno/Maps/9"/>
								<tiles		id="000000001" url="vno/Maps/9/Tiles/"/>
							</map>
							<map id="10">
								<thumbmap	id="000001000" url="vno/Maps/10"/>
								<tiles		id="000001001" url="vno/Maps/10/Tiles/"/>
							</map>
						</mapRes>
						<characterRes>
							<playerRes>
								<player id="0">
									<walk	id="000030000" url=""/>
								</player>
							</playerRes>
							<npcRes>
								<npc id="100000">
									<pic	id="000040000" url="vno/Characters/NPCs/0.png"/>
									<face	id="000040001" url="vno/Characters/NPCs/0.png"/>
								</npc>
								<npc id="100001">
									<pic	id="000040100" url="vno/Characters/NPCs/0.png"/>
									<face	id="000040101" url="vno/Characters/NPCs/0.png"/>
								</npc>
							</npcRes>
						</characterRes>
					</res>
	//				trace(getXML2(resInfo));
	//				trace(getXML3(resInfo));
					var info0=
						<info>
							<map id="9" resId="9" width="6500" height="2800" moveSpeed="10">
								<tiles width="250" height="408" numX="26" numY="7"/>
								<grid row="650" col="280" cellSize="10"/>
								<character>
									<playerLayer>
										<mainPlayer>
											<player id="9" resId="0" x="0" y="0" direction="S" actionNum="8" row="8" col="8"/>
										</mainPlayer>
										<otherPlayer>
										</otherPlayer>
									</playerLayer>
									<npcLayer>
										<npc id="2000" resId="100000" x="70" y="400"/>
										<npc id="2001" resId="100001" x="900" y="100"/>
										<npc id="2002" resId="100000" x="1250" y="499"/>
										<npc id="2003" resId="100001" x="470" y="999"/>
									</npcLayer>
								</character>
							</map>
							<map id="10" resId="10" width="7000" height="5200" moveSpeed="6">
								<tiles width="280" height="208" numX="25" numY="25"/>
								<grid row="260" col="350" cellSize="20"/>
								<character>
									<playerLayer>
										<mainPlayer>
											<player id="9" resId="0" x="0" y="0" direction="S" actionNum="8" row="8" col="8"/>
										</mainPlayer>
										<otherPlayer>
										</otherPlayer>
									</playerLayer>
									<npcLayer>
										<npc id="2000" resId="100000" x="70" y="400"/>
										<npc id="2001" resId="100001" x="900" y="100"/>
										<npc id="2002" resId="100000" x="1250" y="499"/>
										<npc id="2003" resId="100001" x="470" y="999"/>
									</npcLayer>
								</character>
							</map>
						</info>;
//					trace(get0maps(info0));
//					trace(get0players(info0));
//					trace(get0mapRes(info0));
					var res:XML=
						<res>
										<mapRes>
											<map id="9">
												<thumbmap	id="000000000" url="vno/Maps/9"/>
												<tiles		id="000000001" url="vno/Maps/9/Tiles/"/>
											</map>
											<map id="10">
												<thumbmap	id="000001000" url="vno/Maps/10"/>
												<tiles		id="000001001" url="vno/Maps/10/Tiles/"/>
											</map>
										</mapRes>
										<characterRes>
											<playerRes>
												<player id="0">
													<walk	id="000030000" url=""/>
												</player>
											</playerRes>
											<npcRes>
												<npc id="100000">
													<pic	id="000040000" url="vno/Characters/NPCs/0.png"/>
													<face	id="000040001" url="vno/Characters/NPCs/0.png"/>
												</npc>
												<npc id="100001">
													<pic	id="000040100" url="vno/Characters/NPCs/0.png"/>
													<face	id="000040101" url="vno/Characters/NPCs/0.png"/>
												</npc>
											</npcRes>
										</characterRes>
									</res>;
//					trace(get1npcRes(res));
//					trace(get1player(res));
//					trace(get1characterRes(res));
//					trace(get1mapRes(res));
		}
		public function getXML1(resourse:XML):XML
		{
			var mapset:XML=<info/>
			for(var i:int =0;resourse.map[i]!=null;i++)
			{
				mapset.appendChild(<map/>);
				mapset.map[i].@id=resourse.map[i].@id;					//@访问该节点的名字等属性，而不是其根节点
				mapset.map[i].tiles=resourse.map[i].tiles;
			}
			return mapset;
		}
		public function getXML2(resourse:XML):XML
		{
			var chares:XML=<characterRes/>;
			chares.appendChild(<playerRes/>);
			chares.appendChild(<npcRes/>)
			chares.playerRes=resourse.characterRes.playerRes;
			chares.npcRes=resourse.characterRes.npcRes;
			return 	chares;
		}
		public function getXML3(resourse:XML):XML
		{
			var mapRes:XML=<mapResInfo/>;
			for(var i:int =0;resourse.mapRes.map[i]!=null;i++)
			{
				mapRes.appendChild(<map/>);
				mapRes.map[i]=resourse.mapRes.map[i];
			}
			return 	mapRes;
		}
		public function get0players(resourse:XML):XML					//0-c
		{
			var setting:XML=<settings/>;
			for(var i:int =0;resourse.map[i]!=null;i++)
			{
				setting.appendChild(<playerLayer/>);
				setting.playerLayer[i]=resourse.map[i].character.playerLayer;
				setting.appendChild(<npcLayer/>);
				setting.npcLayer[i]=resourse.map[i].character.npcLayer;
			}
			return setting;
		}
		public function get0maps(resourse:XML):XML						//0-p
		{
			var setting:XML=<settings/>;
			for(var i:int =0;resourse.map[i]!=null;i++)
			{
				setting.appendChild(<map/>);
				setting.map[i].@id=resourse.map[i].@id;
				setting.map[i].@resId=resourse.map[i].@resId;
				setting.map[i].@width=resourse.map[i].@width;
				setting.map[i].@height=resourse.map[i].@height;
				setting.map[i].@moveSpeed=resourse.map[i].@moveSpeed;
				setting.map[i].appendChild(<tiles/>);
				setting.map[i].tiles=resourse.map[i].tiles;	
				setting.map[i].appendChild(<grid/>);
				setting.map[i].grid=resourse.map[i].grid;
			}
			return setting;
		}
		public function get0mapRes(resourse:XML):XML
		{
			var mapRes:XML=<mapRes/>;
			for(var i:int =0;resourse.map[i]!=null;i++)
			{
				mapRes.appendChild(<map/>);
				mapRes.map[i].@id=resourse.map[i].@id;
				mapRes.map[i].appendChild(<tiles/>);
				mapRes.map[i].tiles.@numX=resourse.map[i].tiles.@numX;
				mapRes.map[i].tiles.@numY=resourse.map[i].tiles.@numY;
			}
			return mapRes;
		}
		public function get1npcRes(resourse:XML):XML					//1-c
		{
			var chaRes:XML=<chaRes/>;
			for(var i:int =0;resourse.characterRes[i]!=null;i++)
			{
				chaRes.appendChild(<npc/>);
				chaRes.npc=resourse.characterRes.npcRes.npc;
			}
			return chaRes;
		}
		public function get1player(resourse:XML):XML					//1-m
		{
			var chaRes:XML=<chaRes/>;
			for(var i:int =0;resourse.characterRes[i]!=null;i++)
			{
				chaRes.appendChild(<player/>);
				chaRes.player=resourse.characterRes.playerRes.player;
			}
			return chaRes;
		}
		public function get1characterRes(resourse:XML):XML				//1-mc
		{
			var characterRes:XML=<characterRes/>;
			for(var i:int =0;resourse.characterRes[i]!=null;i++)
			{
				characterRes.appendChild(<playerRes/>);
				characterRes.playerRes.appendChild(<res/>);
				characterRes.playerRes.res.@id=resourse.characterRes[i].playerRes.player.@id;
				characterRes.playerRes.res.walk=resourse.characterRes[i].playerRes.player.walk;
				characterRes.appendChild(<npcRes/>);
				for(var j:int=0;resourse.characterRes[i].npcRes.npc[j]!=null;j++)
				{
					characterRes.npcRes.appendChild(<res/>);
					characterRes.npcRes.res[j].@id=resourse.characterRes[i].npcRes.npc[j].@id;
					characterRes.npcRes.res[j].pic=resourse.characterRes[i].npcRes.npc[j].pic;
					characterRes.npcRes.res[j].face=resourse.characterRes[i].npcRes.npc[j].face;
				}
			}
			return characterRes;
		}
		public function get1mapRes(resourse:XML):XML					//1-mm
		{
			var mapRes:XML=<mapRes/>;
			for(var i:int =0;resourse.mapRes.map[i]!=null;i++)
			{
				mapRes.appendChild(<map/>);
				mapRes.map[i]=resourse.mapRes.map[i];
			}
			return mapRes;
		}
	}
}